package cn.itsource.ymcc.web.controller;

import cn.itsource.ymcc.dto.AlipayNotifyDto;
import cn.itsource.ymcc.service.IPayNotifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/pay")
public class PayNotifyController {

    /**
     * 支付宝支付回调
     * @param request
     */
    @Autowired
    private IPayNotifyService payNotifyService;

    @PostMapping("/alipay/notify")
    public String notify(AlipayNotifyDto dto){
        try {
            return payNotifyService.notify(dto);
        } catch (Exception e) {
            e.printStackTrace();
            return "ERROR";// 业务层消费失败 还要再次消费
        }


    }
}
